package com.gimi.cloud.bbp.dao.dao.product;

import com.gimi.cloud.bbp.dto.product.ProductImgDTO;
import com.gimi.cloud.bbp.entity.product.ProductImgEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProductImgDao extends BaseMapper<ProductImgEntity> {
    int deleteByPrimaryKey(int prodImgId);
    
    int deleteByProdId(String prodId);
    
    int insert(ProductImgEntity record);

    int insertSelective(ProductImgEntity record);

    ProductImgEntity selectByPrimaryKey(int prodImgId);
    
    List<ProductImgDTO> selectByprodId(String prodId);

    int updateByPrimaryKeySelective(ProductImgEntity record);

    int updateByPrimaryKey(ProductImgEntity record);
    
    @Select("select img_url as imgUrl from ec_prod_img where prod_id=#{prodId} and is_del=1 and img_type =2 order by seq")
    List<ProductImgDTO> getImgsByProdId(@Param(value ="prodId")String prodId);

    @Select("SELECT img_url FROM ec_prod_img WHERE prod_id = #{prodId}")
    List<String> selectUrlByprodId(String prodId);
}